<script setup lang="ts">
import { defineAsyncComponent, hydrateOnVisible, ref } from 'vue';

import { ElSegmented } from 'element-plus';

defineOptions({
  name: 'SystemNetworkConfig',
});

const options = ['IPv4', 'WiFi'];
const tab = ref('IPv4');
const IPv4 = defineAsyncComponent({
  hydrate: hydrateOnVisible(),
  loader: () => import('./IPv4.vue'),
});
const WiFi = defineAsyncComponent({
  hydrate: hydrateOnVisible(),
  loader: () => import('./WiFi.vue'),
});
</script>
<template>
  <div class="wos-network-config">
    <div class="header">
      <ElSegmented v-model="tab" :options="options" block />
    </div>
    <div class="body">
      <component :is="tab === 'IPv4' ? IPv4 : WiFi" />
    </div>
  </div>
</template>

<style lang="scss">
.wos-network-config {
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  gap: 16px;
  width: 100%;
  height: 100%;
  padding: 16px;

  .header {
    width: 100%;
  }
}
</style>
